﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:vm="clr-namespace:Lithnet.Transforms.Presentation">

    <DataTemplate DataType="{x:Type vm:TransformViewModel}">
        <TabControl Background="White" BorderBrush="Black" BorderThickness="1">
            <TabItem Header="Configuration">
                <DockPanel LastChildFill="False"
                           Margin="5,20,5,5">
                    <Grid DockPanel.Dock="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Label Content="Transform type"
                                   Grid.Row="0"
                                   Grid.Column="0" />
                            <TextBox Text="{Binding Type, Mode=OneWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                                     IsReadOnly="True"
                                     Grid.Row="0"
                                     Grid.Column="1" />
                            <Label Content="Transform ID"
                                   Grid.Row="1"
                                   Grid.Column="0" />
                            <TextBox Text="{Binding Id, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                                     Grid.Row="1"
                                     Grid.Column="1" />
                        </Grid>

                        <ContentControl Content="{Binding}"
                                          Grid.Row="1"
                                          Margin="0,10,0,0">
                            <ContentControl.Resources>
                                <ResourceDictionary>
                                    <ResourceDictionary.MergedDictionaries>
                                        <ResourceDictionary Source="pack://application:,,,/Lithnet.Transforms.Presentation;component/ResourceDictionaries/TransformViewDictionary.xaml" />
                                    </ResourceDictionary.MergedDictionaries>
                                </ResourceDictionary>
                            </ContentControl.Resources>
                        </ContentControl>
                    </Grid>

                    <Grid DataContext="{Binding TransformTest}"
                          DockPanel.Dock="Bottom">
                        <GroupBox Header="Transform Test">
                            <StackPanel Margin="5">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Label Content="Input data type"
                                           Grid.Row="0"
                                           Grid.Column="0" />
                                    <ComboBox Grid.Row="0"
                                              Grid.Column="1"
                                              SelectedItem="{Binding AttributeType, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
                                              ItemsSource="{Binding AllowedInputTypes}" />

                                    <Label Content="{Binding InputValue1Text}"
                                           Grid.Row="1"
                                           Grid.Column="0" />
                                    <TextBox Grid.Row="1"
                                             Grid.Column="1"
                                             Text="{Binding InputValue1, ValidatesOnDataErrors=True, ValidatesOnExceptions=true, UpdateSourceTrigger=PropertyChanged}" />

                                    <Label Content="{Binding InputValue2Text}"
                                           Grid.Row="2"
                                           Visibility="{Binding IsInputValue2Visible, Converter={StaticResource BooleanToVisibilityConverter}}"
                                           Grid.Column="0" />
                                    <TextBox Grid.Row="2"
                                             Grid.Column="1"
                                             Visibility="{Binding IsInputValue2Visible, Converter={StaticResource BooleanToVisibilityConverter}}"
                                             Text="{Binding InputValue2, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}" />

                                    <Label Content="{Binding InputValue3Text}"
                                           Grid.Row="3"
                                           Visibility="{Binding IsInputValue3Visible, Converter={StaticResource BooleanToVisibilityConverter}}"
                                           Grid.Column="0" />
                                    <TextBox Grid.Row="3"
                                             Grid.Column="1"
                                             Visibility="{Binding IsInputValue3Visible, Converter={StaticResource BooleanToVisibilityConverter}}"
                                             Text="{Binding InputValue3, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}" />

                                    <Button Content="Execute"
                                            Command="{Binding Commands.Execute}"
                                            Grid.Row="4"
                                            Grid.Column="1"
                                            MinHeight="27"
                                            MinWidth="90"
                                            Width="Auto"
                                            Margin="5"
                                            HorizontalAlignment="Right" />

                                    <Label Content="Transform output"
                                           Grid.Row="5"
                                           Grid.Column="0" />
                                    <TextBox Grid.Row="5"
                                             Grid.Column="1"
                                             IsReadOnly="True"
                                             Height="Auto"
                                             MinHeight="69"
                                             TextWrapping="Wrap"
                                             Text="{Binding OutputValue, Mode=OneWay}" />

                                </Grid>
                            </StackPanel>
                        </GroupBox>
                    </Grid>
                </DockPanel>
            </TabItem>
            <TabItem Header="Transform Details">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <GroupBox Header="Capabilities"
                              Grid.Row="0"
                              Height="Auto">
                        <StackPanel Margin="5">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Label Content="Multivalued input processing behavior"
                                       Grid.Row="0"
                                       Grid.Column="0"
                                       Margin="0,5,10,5" />
                                <TextBlock Grid.Row="0"
                                           Grid.Column="1"
                                           Text="{Binding MVBehaviour, Mode=OneWay}"
                                           TextWrapping="Wrap" />

                                <Label Content="Supports loop-back target attribute processing"
                                       Grid.Row="1"
                                       Grid.Column="0"
                                       Margin="0,5,10,5" />

                                <CheckBox Grid.Row="1"
                                          Grid.Column="1"
                                          IsEnabled="False"
                                          IsChecked="{Binding IsLoopbackSupported, Mode=OneWay}" />

                                <Label Content="Return type is user-definable"
                                       Grid.Row="3"
                                       Grid.Column="0"
                                       Margin="0,5,10,5" />

                                <CheckBox Grid.Row="3"
                                          Grid.Column="1"
                                          IsEnabled="False"
                                          IsChecked="{Binding IsUserDefinableReturnType, Mode=OneWay}" />

                                <Label Content="Supported input attribute types"
                                       Grid.Row="4"
                                       Grid.Column="0"
                                       Margin="0,5,10,5" />

                                <TextBlock Grid.Row="4"
                                           Grid.Column="1"
                                           Text="{Binding SupportedInputTypes, Mode=OneWay}"
                                           TextWrapping="Wrap" />

                                <Label Content="Possible return types"
                                       Grid.Row="5"
                                       Grid.Column="0"
                                       Margin="0,5,10,5" />

                                <TextBlock Grid.Row="5"
                                           Grid.Column="1"
                                           Text="{Binding PossibleReturnTypes, Mode=OneWay}"
                                           TextWrapping="Wrap" />

                            </Grid>
                        </StackPanel>
                    </GroupBox>
                    <GroupBox Header="Description"
                              Grid.Row="1">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <ScrollViewer>
                                <TextBox Grid.Row="0"
                                         Grid.Column="0"
                                         ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         HorizontalAlignment="Stretch"
                                         VerticalAlignment="Stretch"
                                         IsReadOnly="true"
                                         Margin="5,5,5,5"
                                         Text="{Binding TransformDescription, Mode=OneWay}"
                                         TextWrapping="Wrap" />
                            </ScrollViewer>
                        </Grid>
                    </GroupBox>
                </Grid>
            </TabItem>
        </TabControl>
    </DataTemplate>
</ResourceDictionary>